using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace qPrintComponent
{
    //typedef struct _DRIVER_INFO_3 { 
    //    DWORD  cVersion; 
    //    LPTSTR pName; 
    //    LPTSTR pEnvironment; 
    //    LPTSTR pDriverPath; 
    //    LPTSTR pDataFile; 
    //    LPTSTR pConfigFile; 
    //    LPTSTR pHelpFile; 
    //    LPTSTR pDependentFiles; 
    //    LPTSTR pMonitorName; 
    //    LPTSTR pDefaultDataType; 
    //} DRIVER_INFO_3, *PDRIVER_INFO_3; 

    
    public sealed class DriverInfo3 : qSafeDriverInfo
    {
        public DriverInfo3(SafeHandle PrinterHandle)
            : base(PrinterHandle, 3)
        { }

        public DriverInfo3(IntPtr MemoryHandle)
            : base(MemoryHandle, 3)
        { }
        public override string ToString()
        {
            string s= string.Empty;
            try
            { s= System.IO.Path.GetFileName(DriverPath);}
            catch
            { s= DriverPath;}
            return s;
        }
        [Description(@"Specifies the operating system version for which the driver was written. Currently it can be the following. Value Meaning 3 Driver for Windows 2000/XP.")]
        public int Version
        {
            get { return GetIntField(0); }
        }
        [Description(@"The name of the driver (for example, QMS 810).")]
        public string Name
        {
            get { return GetStringField(1); }
        }
        [Description(@"The environment for which the driver was written (for example, Windows NT x86, Windows IA64, Windows x64, Windows NT R4000, Windows NT Alpha_AXP, Windows 4.0, or Windows NT PowerPC).")]
        public string Environment
        {
            get { return GetStringField(2); }
        }
        [Description(@"The file that contains the device driver (for example, C:\DRIVERS\Pscript.dll).")]
        public string DriverPath
        {
            get { return GetStringField(3); }
        }
        [Description(@"The file that contains driver data (for example, C:\DRIVERS\Qms810.ppd).")]
        public string DataFile
        {
            get { return GetStringField(4); }
        }
        [Description(@"Tthe device driver's configuration dynamic-link library (for example, C:\DRIVERS\Pscrptui.dll).")]
        public string ConfigFile
        {
            get { return GetStringField(5); }
        }
        [Description(@"The device driver's help file (for example, C:\DRIVERS\Pscrptui.hlp).")]
        public string HelpFile
        {
            get { return GetStringField(6); }
        }
        [Description(@"The files the driver depends on. Each file name is separated by a backslash and a null character (for example, Pscript.dll\0QMS810.ppd\0Pscriptui.dll\0Pscriptui.hlp\0Pstest.txt\0\0).")]
        public string DependentFiles
        {
            get { return GetStringField(7); }
        }
        [Description(@"A language monitor (for example, 'PJL monitor'). This member can be NULL and should be specified only for printers capable of bidirectional communication.")]
        public string MonitorName
        {
            get { return GetStringField(8); }
        }
        [Description(@"The default data type of the print job (for example, 'EMF').")]
        public string DefaultDataType
        {
            get { return GetStringField(9); }
        }
    }
}